package com.tarena.demo.luban.all.main.rpc;

import com.tarena.demo.luban.all.main.service.CartService;
import com.tarena.demo.luban.protocol.cart.param.CartDeleteParam;
import com.tarena.luban.demo.cart.api.CartRpcApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * bean的id是默认的 cartRpcImpl
 */
@Component(value = "cartRpcImpl")
public class CartRpcImpl implements CartRpcApi {

    @Autowired
    CartService cartService;

    @Override
    public void cartDelete(String userId, String productCode) {
        // 调用业务层删除购物车
        CartDeleteParam cartDeleteParam = new CartDeleteParam();
        cartDeleteParam.setProductCode(productCode);
        cartDeleteParam.setUserId(userId);
        cartService.deleteCart(cartDeleteParam);
    }
}
